

LuaManager = { __Name = 'LuaManager' }

function LuaManager.Get(id)

      local t = { Id = id }
      setmetatable(t,LuaManager.MetaTable)
      return t
      
end

function LuaManager.ConvertFrom(t)

      return LuaManager.Get(t.Id)
end

function LuaManager:GetObject(id)

      local id = LuaManagerServant4LuaCall(self.Id,0,id)
      return Object.Get(id)
end

function LuaManager:AddGlobalObject(obj)

      return LuaManagerServant4LuaCall(self.Id,1,obj.Id)
end

function LuaManager:SetGlobalObject(id,obj)

      LuaManagerServant4LuaCall(self.Id,2,id,obj.Id)
end

function LuaManager.get_Instance()

      local id = LuaManagerServant4LuaCall(0,3)
      return LuaManager.Get(id)
end

LuaManager.__GetProperty = 
{
      Instance = LuaManager.get_Instance
}

LuaManager.__SetProperty = 
{
}

function LuaManager.__GetByIndex(t,k)

      local pf = LuaManager.__GetProperty[k]
      if pf ~= nil then
          return pf(t)
      end
      local f = LuaManager.__Method[k]
      if f ~= nil then
          return f
      end
      return Object.__GetByIndex(t,k)
end

function LuaManager.__SetByIndex(t,k,v)

      local pf = LuaManager.__SetProperty[k]
      if pf ~= nil then
              pf(t,v)
            return
      end
      Object.__SetByIndex(t,k,v)
      return
end

LuaManager.__Method = { 
          GetObject = LuaManager.GetObject,
          AddGlobalObject = LuaManager.AddGlobalObject,
          SetGlobalObject = LuaManager.SetGlobalObject
}

LuaManager.MetaTable = { __index = LuaManager.__GetByIndex,__newindex = LuaManager.__SetByIndex }
setmetatable(LuaManager,LuaManager.MetaTable)